package org.gdpu.model;

import javax.persistence.*;
import java.util.Date;

/**
 * Created by HEWI2 on 1/22/14.
 */
@Entity
public class Maintaining {

    /**
     * 流水编号
     */
    private int id;
    /**
     * 申请宿舍
     */
    private Dormitory dormitory;
    /**
     * 申请时间
     */
    private Date applyDate;
    /**
     * 解决时间
     */
    private Date solveDate;
    /**
     * 维修记录状态
     */
    private MaintainingState state;
    /**
     * 评价
     */
    private String evaluate;
    /**
     * 联系电话
     */
    private String phone;
    /**
     * 维修描述
     */
    private String description;
    /**
     * 维修人
     */
    private User check;
    /**
     * 希望维修时间
     */
    private String preferTime;

    @Id
    @GeneratedValue
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @ManyToOne
    @JoinColumn(name = "dormitoryId", nullable = false)
    public Dormitory getDormitory() {
        return dormitory;
    }

    public void setDormitory(Dormitory dormitory) {
        this.dormitory = dormitory;
    }

    @Temporal(TemporalType.TIMESTAMP)
    @Column(nullable = false)
    public Date getApplyDate() {
        return applyDate;
    }

    public void setApplyDate(Date applyDate) {
        this.applyDate = applyDate;
    }

    @Temporal(TemporalType.TIMESTAMP)
    public Date getSolveDate() {
        return solveDate;
    }

    public void setSolveDate(Date solveDate) {
        this.solveDate = solveDate;
    }

    @Enumerated(EnumType.ORDINAL)
    @Column(nullable = false)
    public MaintainingState getState() {
        return state;
    }

    public void setState(MaintainingState state) {
        this.state = state;
    }

    @Column(length = 300)
    public String getEvaluate() {
        return evaluate;
    }

    public void setEvaluate(String evaluate) {
        this.evaluate = evaluate;
    }

    @Column(nullable = false, length = 15)
    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    @Column(nullable = false, length = 300)
    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    @ManyToOne
    @JoinColumn(name = "checkMan")
    public User getCheck() {
        return check;
    }

    public void setCheck(User check) {
        this.check = check;
    }

    public String getPreferTime() {
        return preferTime;
    }

    public void setPreferTime(String preferTime) {
        this.preferTime = preferTime;
    }
}
